{include file="public/header" /}
    <style>
        body {
            background-color: #ffffff;
        }
        .layui-form-label{
            width: 120px;
        }
        .layui-input-block {
            margin-left: 150px;
        }
        .layui-input, .layui-textarea
        {
            width: 48%;
        }
    </style>
</head>
<body>

<div class="layui-tab">
    <ul class="layui-tab-title">
        <li >
            <a target="_self" class="current" href="/admin/setting/system">
                网站设置
            </a>
        </li>

        <li class="layui-this">
            <a target="_self" class="current" href="/admin/setting/upload">
                存储配置
            </a>
        </li>
        <li>
            <a target="_self" class="current" href="/admin/setting/sms">
                短信配置
            </a>
        </li>

        <li>
            <a target="_self" class="current" href="/admin/setting/service">
                客服信息
            </a>
        </li>
    </ul>
</div>

<form class="layui-form" action="">
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">上传设置</li>
            <li>服务配置</li>
            <li>默认图片</li>
        </ul>
        <div class="layui-tab-content" style="height: 100px;">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <label class="layui-form-label">存储服务商</label>
                    <div class="layui-input-block">
                        <select name="platform" id="platform" lay-verify="required" >
                            <option value="qiniu">七牛云</option>
                            <option value="local">本地</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">静态资源CDN</label>
                    <div class="layui-input-block">
                        <input type="text" name="resource_cdn"  class="layui-input" value="{$_info.resource_cdn}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">静态资源版本</label>
                    <div class="layui-input-block">
                        <input type="text" name="resource_version"  class="layui-input" value="{$_info.resource_version}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">上传最小限制</label>
                    <div class="layui-input-block">
                        <input type="text" name="upload_config[_default][fsizeMin]"  class="layui-input" value="{$_info.upload_config._default['fsizeMin']}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">上传最大限制</label>
                    <div class="layui-input-block">
                        <input type="text" name="upload_config[_default][fsizeLimit]"  class="layui-input" value="{$_info.upload_config._default['fsizeLimit']}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">类型限制</label>
                    <div class="layui-input-block">
                        <input type="text" name="upload_config[_default][mimeLimit]"  class="layui-input" value="{$_info.upload_config._default['mimeLimit']}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">文件后缀名</label>
                    <div class="layui-input-block">
                        <input type="text" name="upload_config[_default][allowExts]"  class="layui-input" value="{$_info.upload_config._default['allowExts']}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">保存路径规则</label>
                    <div class="layui-input-block">
                        <input type="text" name="upload_config[_default][path]"  class="layui-input" value="{$_info.upload_config._default['path']}">
                    </div>
                </div>
            </div>

            <div class="layui-tab-item">

                <div class="layui-form-item">
                    <label class="layui-form-label">应用Access_key</label>
                    <div class="layui-input-block">
                        <input type="text" name="platform_config[access_key]"  class="layui-input" value="{$_info.platform_config.access_key}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">应用Secret_key</label>
                    <div class="layui-input-block">
                        <input type="text" name="platform_config[secret_key]"  class="layui-input" value="{$_info.platform_config.secret_key}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">应用bucket</label>
                    <div class="layui-input-block">
                        <input type="text" name="platform_config[bucket]"  class="layui-input" value="{$_info.platform_config.bucket}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">应用Root_path</label>
                    <div class="layui-input-block">
                        <input type="text" name="platform_config[root_path]"  class="layui-input" value="{$_info.platform_config.root_path}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">应用Base_url组</label>
                    <div class="layui-input-block">
                        <input type="text" name="platform_config[base_url]"  class="layui-input" value="{$_info.platform_config.base_url}">
                    </div>
                </div>

            </div>

            <div class="layui-tab-item">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                    <legend>默认注册头像</legend>
                </fieldset>
                <div class="layui-form-item">
                    <label class="layui-form-label">注册头像1</label>
                    <div class="layui-input-block">
                        <input type="text" name="reg_avatar[0]"  class="layui-input" value="{$_info.reg_avatar[0]}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">注册头像2</label>
                    <div class="layui-input-block">
                        <input type="text" name="reg_avatar[1]"  class="layui-input" value="{$_info.reg_avatar[1]}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">注册头像3</label>
                    <div class="layui-input-block">
                        <input type="text" name="reg_avatar[2]"  class="layui-input" value="{$_info.reg_avatar[2]}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">注册头像4</label>
                    <div class="layui-input-block">
                        <input type="text" name="reg_avatar[3]"  class="layui-input" value="{$_info.reg_avatar[3]}">
                    </div>
                </div>

                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                    <legend>默认资源图片</legend>
                </fieldset>

                <div class="layui-form-item">
                    <label class="layui-form-label">通用默认头像</label>
                    <div class="layui-input-block">
                        <input type="text" name="image_defaults[avatar]"  class="layui-input" value="{$_info.image_defaults.avatar}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">后台logo</label>
                    <div class="layui-input-block">
                        <input type="text" name="image_defaults[admin_logo]"  class="layui-input" value="{$_info.image_defaults.admin_logo}">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">wap网站logo</label>
                    <div class="layui-input-block">
                        <input type="text" name="image_defaults[wap_logo]"  class="layui-input" value="{$_info.image_defaults.wap_logo}">
                    </div>
                </div>

            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit lay-filter="saveBtn">立即提交</button>
        </div>
    </div>

</form>

</body>

{include file="public/footer" /}
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            $.ajax({
                url: "{:url('upload')}",
                type: 'post',
                dataType: 'json',
                data: data.field,
                timeout: 2000,
                success: function (data1) {
                    if (data1.code == 0) {
                        layer.msg(data1.msg)
                        setTimeout(function () {
                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(iframeIndex);
                        }, 1000);
                    } else {
                        layer.msg(data1.msg)
                    }
                },
                error: function () {
                    layer.msg("添加失败")
                }
            })
            return false;
        });

        var platform = "{:isset($_info.platform) ? $_info.platform : ''}";
        $('#platform').find("option[value="+platform+"]").attr("selected",true);
        form.render('select')
    });
</script>

</html>